/**
 * Copyright (c) 2010 CWI Amsterdam and others. All rights reserved.
 * This program and the accompanying materials are made available
 * under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     CWI Amsterdam - initial API and implementation
 *
 * $Id$
 */
package nl.cwi.arne.mcrl2.factory;

import nl.cwi.arne.mcrl2.Allow;
import nl.cwi.arne.mcrl2.Atom;
import nl.cwi.arne.mcrl2.AtomicAction;
import nl.cwi.arne.mcrl2.BasicTerm;
import nl.cwi.arne.mcrl2.Block;
import nl.cwi.arne.mcrl2.Choice;
import nl.cwi.arne.mcrl2.Communication;
import nl.cwi.arne.mcrl2.Comparator;
import nl.cwi.arne.mcrl2.Comparison;
import nl.cwi.arne.mcrl2.Conjunction;
import nl.cwi.arne.mcrl2.Disjunction;
import nl.cwi.arne.mcrl2.Element;
import nl.cwi.arne.mcrl2.Equation;
import nl.cwi.arne.mcrl2.Function;
import nl.cwi.arne.mcrl2.FunctionCall;
import nl.cwi.arne.mcrl2.FunctionType;
import nl.cwi.arne.mcrl2.Hide;
import nl.cwi.arne.mcrl2.IfThenElse;
import nl.cwi.arne.mcrl2.Implication;
import nl.cwi.arne.mcrl2.Instance;
import nl.cwi.arne.mcrl2.Lambda;
import nl.cwi.arne.mcrl2.Negation;
import nl.cwi.arne.mcrl2.Parallelism;
import nl.cwi.arne.mcrl2.PrimitiveConstraint;
import nl.cwi.arne.mcrl2.PrimitiveSort;
import nl.cwi.arne.mcrl2.PrimitiveType;
import nl.cwi.arne.mcrl2.Sequence;
import nl.cwi.arne.mcrl2.SortType;
import nl.cwi.arne.mcrl2.Specification;
import nl.cwi.arne.mcrl2.Structure;
import nl.cwi.arne.mcrl2.Summation;
import nl.cwi.arne.mcrl2.Synchronization;
import nl.cwi.arne.mcrl2.TupleType;
import nl.cwi.arne.mcrl2.UserSort;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

/**
 * <!-- begin-user-doc -->
 * The <b>Factory</b> for the model.
 * It provides a create method for each non-abstract class of the model.
 * <!-- end-user-doc -->
 * @see nl.cwi.arne.mcrl2.factory.MCRL2Package
 * @generated
 */
public class MCRL2Factory extends EFactoryImpl {
	/**
	 * The singleton instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static final MCRL2Factory eINSTANCE = init();

	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static MCRL2Factory init() {
		try {
			MCRL2Factory theMCRL2Factory = (MCRL2Factory)EPackage.Registry.INSTANCE.getEFactory("http://www.cwi.nl/arne/mcrl2/2010"); 
			if (theMCRL2Factory != null) {
				return theMCRL2Factory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new MCRL2Factory();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MCRL2Factory() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case MCRL2Package.SPECIFICATION: return createSpecification();
			case MCRL2Package.PRIMITIVE_SORT: return createPrimitiveSort();
			case MCRL2Package.USER_SORT: return createUserSort();
			case MCRL2Package.STRUCTURE: return createStructure();
			case MCRL2Package.ELEMENT: return createElement();
			case MCRL2Package.PROCESS: return createProcess();
			case MCRL2Package.ATOM: return createAtom();
			case MCRL2Package.ATOMIC_ACTION: return createAtomicAction();
			case MCRL2Package.SYNCHRONIZATION: return createSynchronization();
			case MCRL2Package.PARALLELISM: return createParallelism();
			case MCRL2Package.SEQUENCE: return createSequence();
			case MCRL2Package.CHOICE: return createChoice();
			case MCRL2Package.INSTANCE: return createInstance();
			case MCRL2Package.IMPLICATION: return createImplication();
			case MCRL2Package.COMMUNICATION: return createCommunication();
			case MCRL2Package.ALLOW: return createAllow();
			case MCRL2Package.BLOCK: return createBlock();
			case MCRL2Package.HIDE: return createHide();
			case MCRL2Package.SUMMATION: return createSummation();
			case MCRL2Package.BASIC_TERM: return createBasicTerm();
			case MCRL2Package.FUNCTION: return createFunction();
			case MCRL2Package.PRIMITIVE_CONSTRAINT: return createPrimitiveConstraint();
			case MCRL2Package.CONJUNCTION: return createConjunction();
			case MCRL2Package.DISJUNCTION: return createDisjunction();
			case MCRL2Package.NEGATION: return createNegation();
			case MCRL2Package.COMPARISON: return createComparison();
			case MCRL2Package.EQUATION: return createEquation();
			case MCRL2Package.LAMBDA: return createLambda();
			case MCRL2Package.IF_THEN_ELSE: return createIfThenElse();
			case MCRL2Package.FUNCTION_CALL: return createFunctionCall();
			case MCRL2Package.PRIMITIVE_TYPE: return createPrimitiveType();
			case MCRL2Package.SORT_TYPE: return createSortType();
			case MCRL2Package.TUPLE_TYPE: return createTupleType();
			case MCRL2Package.FUNCTION_TYPE: return createFunctionType();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case MCRL2Package.COMPARATOR:
				return createComparatorFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case MCRL2Package.COMPARATOR:
				return convertComparatorToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Specification createSpecification() {
		Specification specification = new Specification(){};
		return specification;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PrimitiveSort createPrimitiveSort() {
		PrimitiveSort primitiveSort = new PrimitiveSort(){};
		return primitiveSort;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public UserSort createUserSort() {
		UserSort userSort = new UserSort(){};
		return userSort;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Structure createStructure() {
		Structure structure = new Structure(){};
		return structure;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Element createElement() {
		Element element = new Element(){};
		return element;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public nl.cwi.arne.mcrl2.Process createProcess() {
		nl.cwi.arne.mcrl2.Process process = new nl.cwi.arne.mcrl2.Process(){};
		return process;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Atom createAtom() {
		Atom atom = new Atom(){};
		return atom;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AtomicAction createAtomicAction() {
		AtomicAction atomicAction = new AtomicAction(){};
		return atomicAction;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Synchronization createSynchronization() {
		Synchronization synchronization = new Synchronization(){};
		return synchronization;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Parallelism createParallelism() {
		Parallelism parallelism = new Parallelism(){};
		return parallelism;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Sequence createSequence() {
		Sequence sequence = new Sequence(){};
		return sequence;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Choice createChoice() {
		Choice choice = new Choice(){};
		return choice;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Instance createInstance() {
		Instance instance = new Instance(){};
		return instance;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Implication createImplication() {
		Implication implication = new Implication(){};
		return implication;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Communication createCommunication() {
		Communication communication = new Communication(){};
		return communication;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Allow createAllow() {
		Allow allow = new Allow(){};
		return allow;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Block createBlock() {
		Block block = new Block(){};
		return block;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Hide createHide() {
		Hide hide = new Hide(){};
		return hide;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Summation createSummation() {
		Summation summation = new Summation(){};
		return summation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BasicTerm createBasicTerm() {
		BasicTerm basicTerm = new BasicTerm(){};
		return basicTerm;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Function createFunction() {
		Function function = new Function(){};
		return function;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PrimitiveConstraint createPrimitiveConstraint() {
		PrimitiveConstraint primitiveConstraint = new PrimitiveConstraint(){};
		return primitiveConstraint;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FunctionType createFunctionType() {
		FunctionType functionType = new FunctionType(){};
		return functionType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TupleType createTupleType() {
		TupleType tupleType = new TupleType(){};
		return tupleType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FunctionCall createFunctionCall() {
		FunctionCall functionCall = new FunctionCall(){};
		return functionCall;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PrimitiveType createPrimitiveType() {
		PrimitiveType primitiveType = new PrimitiveType(){};
		return primitiveType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SortType createSortType() {
		SortType sortType = new SortType(){};
		return sortType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Conjunction createConjunction() {
		Conjunction conjunction = new Conjunction(){};
		return conjunction;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Disjunction createDisjunction() {
		Disjunction disjunction = new Disjunction(){};
		return disjunction;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Negation createNegation() {
		Negation negation = new Negation(){};
		return negation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Comparison createComparison() {
		Comparison comparison = new Comparison(){};
		return comparison;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Equation createEquation() {
		Equation equation = new Equation(){};
		return equation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Lambda createLambda() {
		Lambda lambda = new Lambda(){};
		return lambda;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IfThenElse createIfThenElse() {
		IfThenElse ifThenElse = new IfThenElse(){};
		return ifThenElse;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Comparator createComparatorFromString(EDataType eDataType, String initialValue) {
		Comparator result = Comparator.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertComparatorToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MCRL2Package getMCRL2Package() {
		return (MCRL2Package)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static MCRL2Package getPackage() {
		return MCRL2Package.eINSTANCE;
	}

} //MCRL2Factory
